<?php
  
	$user = $controller->getCurrentUser();
	//on verifie les permissions
	if ($user->isAllowedTo(GRADE_MOD_BOOK))
	{
		if ((!$idAlbum = $request->getParam('idAlbum')) || !is_numeric($idAlbum))
		{
			$controller->addError('Une erreur est survenue lors de la suppression d\'un album. Si le probl&eacute;me persiste, veuillez contacter le webmaster');
			$cotationsList = book::getCotationList();
			$controller->setVar('cotationsList',$cotationsList);
			$controller->render('changeBook');
		}
		else
		{
			$book = book::singleton($idAlbum, 'id');
			$book->remove();
			
			$logPermAction = 'Album supprim&eacute; : '.addslashes($book->getName());
			logPermactions($user->getId(), $logPermAction); 
			
			$controller->addInformation('L\'album a bien &eacute;t&eacute; supprim&eacute; !');
			$cotationsList = book::getCotationList();
			$controller->setVar('cotationsList',$cotationsList);
			$controller->render('changeBook');
		}
	}
	else 
		$controller->render('errorRights');
		
?>
